﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Common;

namespace Ex01
{
    class Program
    {
        static void Main(string[] args)
        {
            Regex wordCounter = new Regex(@"\b(\w|[-'])+\b");

            // Click the 'SQL' tab below after running this query - notice that only the topic filtering
            // predicate executes on SQL Server.
            var db = new NorthwindEntities();
            var query = db.MedicalArticles
                .Where(article => article.Topic == "influenza")
                .AsEnumerable()  //Linq to Object
                .Where(article => wordCounter.Matches(article.Abstract).Count < 100);

            query.Dump();
            Console.ReadKey();
        }
    }
}
